<template>
  <div class="bg-[#232324] h-[100%]">
    <el-collapse v-loading="loading" v-model="activeNames">
      <el-form label-width="100" :model="states" size="default">
        <el-collapse-item :title="`指定表格字段`" name="asdfa">
          <KeyValueModule
            v-model:list="states.arrtData"
            key1="label"
            key2="prop"
          />
        </el-collapse-item>
        <el-collapse-item title="表格属性" name="1" class="myCol">
          <el-form-item label="边框">
            <el-switch v-model="states.border" />
          </el-form-item>
          <el-form-item label="开启溢出提示">
            <el-switch v-model="states.showOverflowTooltip" />
          </el-form-item>
          <el-form-item label="是否显示序号">
            <el-switch v-model="states.showIndex" />
          </el-form-item>
          <el-form-item label="是否显示表头">
            <el-switch v-model="states.showHeader" />
          </el-form-item>
          <el-form-item label="表格字体颜色">
            <el-color-picker v-model="states.cellStyle.color" />
          </el-form-item>
          <el-form-item label="表格字体大小">
            <el-input v-model="states.cellStyle.fontSize" />
          </el-form-item>
          <el-form-item label="表头字体颜色">
            <el-color-picker v-model="states.headerCellStyle.color" />
          </el-form-item>
          <el-form-item label="表头字体大小">
            <el-input v-model="states.headerCellStyle.fontSize" />
          </el-form-item>
          <el-form-item label="布局方式">
            <el-select v-model="states.tableLayout" placeholder="请选择">
              <el-option label="auto" value="auto" />
              <el-option label="fixed" value="fixed" />
            </el-select>
          </el-form-item>
          <el-form-item label="空数据时文字">
            <el-input v-model="states.emptyText" />
          </el-form-item>
        </el-collapse-item>
      </el-form>
    </el-collapse>
  </div>
</template>

<script setup>
import { computed, onMounted, ref } from "vue";
import KeyValueModule from "@renderer/components/keyValueModule/index.vue";
const loading = ref(true);
const activeNames = ref();
const props = defineProps({
  models: {
    type: Object,
    default: () => ({}),
  },
});
const emit = defineEmits(["update:models"]);

onMounted(() => {
  setTimeout(() => {
    loading.value = false;
  }, 200);
});

const states = computed({
  get: () => props.models,
  set: () => emit("update:models"),
});
</script>

<style scoped lang="scss">
:deep(.el-collapse-item__header) {
  padding-left: 10px !important;
}
:deep(.el-select) {
  width: 180px !important;
}

:deep(.el-table tr) {
  background-color: #232324 !important;
}
:deep(.el-table th.el-table__cell) {
  background-color: #232324 !important;
}

:deep(.myCol .el-input) {
  width: 180px !important;
}
:deep(.myCol .el-select) {
  width: 180px !important;
}
</style>
